package net.lab1024.sa.admin.module.business.erp.bas.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.bas.domain.entity.CalendarsEntity;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.CalendarsAddForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.CalendarsQueryForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.CalendarsUpdateForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.vo.CalendarsVO;
import net.lab1024.sa.admin.module.business.erp.bas.service.CalendarsService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 日历 Controller
 *
 * @Author AKITA
 * @Date 2025-04-18 08:50:24
 * @Copyright AKITA
 */

@RestController
@Tag(name = "日历")
public class CalendarsController {

    @Resource
    private CalendarsService calendarsService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/calendars/queryPage")
    public ResponseDTO<PageResult<CalendarsVO>> queryPage(@RequestBody @Valid CalendarsQueryForm queryForm) {
        return ResponseDTO.ok(calendarsService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/calendars/add")
    public ResponseDTO<Long> add(@RequestBody @Valid CalendarsAddForm addForm) {
        return calendarsService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/calendars/update")
    public ResponseDTO<String> update(@RequestBody @Valid CalendarsUpdateForm updateForm) {
        return calendarsService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/calendars/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return calendarsService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/calendars/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return calendarsService.delete(docEntry);
    }


    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/calendars/info/{docEntry}")
    public ResponseDTO<CalendarsEntity> info(@PathVariable Long docEntry) throws InterruptedException {
        return calendarsService.info(docEntry);
    }

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/calendars/excute")
    public ResponseDTO<String> excuteService(@RequestBody CalendarsQueryForm queryForm) {
        return calendarsService.excuteService(queryForm);
    }


}
